package jdk.thread.lock;

import java.util.concurrent.locks.Lock;
import java.util.concurrent.locks.StampedLock;

public class StampedLockTest {

    public static void main(String[] args) {
        StampedLock lock = new StampedLock();

        long stamp = lock.tryOptimisticRead();

        if(!lock.validate(stamp)){
            stamp = lock.readLock();
            /**
             * TODO
             */
            lock.unlockRead(stamp);
        }
    }
}
